<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入 layui.css -->
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">
    <!-- 引入 layui.js -->
    <script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>

<body>
    <div class="layui-form-item" id="div2">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-inline">
            <input type="text" name="password" required lay-verify="required" placeholder="姓名" autocomplete="off"
                class="layui-input" id="name">
        </div>

        <button class="layui-btn layui-btn-radius layui-btn-normal" id="Search">搜索</button>
        <!-- <button class="layui-btn layui-btn-radius layui-btn-normal" id="Add_to">添加</button> -->

        <table class="layui-table">
            <thead>
                <th>id</th>
                <th>姓名</th>
                <th>头像</th>
                <th>登录时间</th>
                <th>注册时间</th>
                <th>操作</th>
            </thead>
            <tbody id="tbo">

            </tbody>
        </table>
    </div>

    <div class="layui-footer">
        <div id="test1"></div>
    </div>

    </div>


</body>
<script>
    //渲染列表
    fun()
    function fun(i) {
        $.ajax({
            type: 'GET',
            url: 'https://api.zzgoodqc.cn/api/user',
            // headers: {
            //     'Content-Type': 'application/json',
            //     Authorization: `Bearer ${add.toubu}`
            // },
            dataType: 'json',
            success: function (res) {
                console.log(res);
                // if (res.code == 200) {
                //     let add = ''
                //     for (let i in res.data) {
                //         add += `<tr>
                //         <td>${res.data[i].id}</td>
                //         <td>${res.data[i].username}</td>
                //         <td><img src="${res.data[i].img}"></td>
                //         <td>${res.data[i].created_at}</td>
                //         <td>${res.data[i].updated_at}</td>
                //         <td><a href="#" onclick="Delete(${res.data[i].id})">删除</a> | <a href="#" onclick="detail(${res.data[i].id})">详情</a> | <a href="#" onclick="update(${res.data[i].id})">更新</a></td>
                //         </tr>`
                //     }
                //     $('#tbo').html(add)
                // } else {
                //     window.location.href = './登录.html'
                // }
            },
        })
    }

</script>

</html>